﻿@{
    ViewBag.Title = "Home";
}

<h2>Resumen de la Emergencia</h2>
<br />
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
        google.load("visualization", "1", {packages:["corechart"]});
        google.setOnLoadCallback(drawChart);
        function drawChart() {
            $.post('GetDataInventario', {}, function(data){
                var tdata = new google.visualization.DataTable();

                tdata.addColumn('string', 'Country');
                tdata.addColumn('number', 'Cantidad');

                for (var i = 0; i < data.length; i++) {
                    tdata.addRow([data[i].Name, data[i].Value]);
                }

                var options = {
                    title: 'Inventarios',
                    backgroundColor: '#efeeef'
                };

                var chart = new google.visualization.PieChart(document.getElementById('chart_div_1'));
                chart.draw(tdata, options);
            });
        };
</script>

<script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
        google.load("visualization", "1", { packages: ["corechart"] });
        google.setOnLoadCallback(drawChart);
        function drawChart() {
            $.post('GetDataSolicitud', {}, function (data) {
                var tdata = new google.visualization.DataTable();

                tdata.addColumn('string', 'Country');
                tdata.addColumn('number', 'Cantidad');

                for (var i = 0; i < data.length; i++) {
                    tdata.addRow([data[i].Name, data[i].Value]);
                }

                var options = {
                    title: 'Solicitudes',
                    backgroundColor: '#efeeef'
                };

                var chart = new google.visualization.PieChart(document.getElementById('chart_div_2'));
                chart.draw(tdata, options);
            });
        };
</script>

<script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
        google.load("visualization", "1", { packages: ["corechart"] });
        google.setOnLoadCallback(drawChart);
        function drawChart() {
            $.post('GetDataDano', {}, function (data) {
                var tdata = new google.visualization.DataTable();

                tdata.addColumn('string', 'Daño');
                tdata.addColumn('number', 'Cantidad');

                for (var i = 0; i < data.length; i++) {
                    tdata.addRow([data[i].Name, data[i].Value]);
                }

                var options = {
                    title: 'Daños',
                    backgroundColor: '#efeeef'
                };

                var chart = new google.visualization.ColumnChart(document.getElementById('chart_div_3'));
                chart.draw(tdata, options);
            });
        };
</script>

<table>
    <tr>
        <th>
            <div id="chart_div_1" style="width: 500px; height: 250px"></div>
            @Html.ActionLink("Ver más", "Inventarios", "Almacen")
        </th>
        <th>
            <div id="chart_div_2" style="width: 500px; height: 250px"></div>
            @Html.ActionLink("Ver más", "Check", "Almacen")
        </th>
    </tr>
</table>
<table>
    <tr>
        <th>
            <div id="chart_div_3" style="width: 1000px; height: 250px"></div>
            @Html.ActionLink("Ver más", "GenerarConsolidado", "Emergencia")
        </th>
    </tr>
</table>